<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    ul,
    li {
      list-style: none;
    }

    ul {
      position: relative;
      display: flex;
      width: 900px;
      height: 40px;
      margin: 200px auto 0;
      border-bottom: 5px solid pink;
    }

    ul>li {
      display: flex;
      flex: 1;
      justify-content: center;
      align-items: center;
      cursor: pointer;
    }

    ul>span {
      position: absolute;
      left: 0;
      bottom: -5px;
      width: 100px;
      height: 5px;
      background-color: red;
    }

    ul>p {
      position: absolute;
      top: 0;
      left: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100px;
      height: 40px;
      background-color: skyblue;
      color: #fff;
      cursor: pointer;
    }
  </style>
</head>

<body>
  <ul>
    <li>第1个选项</li>
    <li>第2个选项</li>
    <li>第3个选项</li>
    <li>第4个选项</li>
    <li>第5个选项</li>
    <li>第6个选项</li>
    <li>第7个选项</li>
    <li>第8个选项</li>
    <li>第9个选项</li>
    <p>第1个选项</p>
    <span></span>
  </ul>

  <script src="../jquery/jquery.min.js"></script>
  <script>
    $('ul>li').mouseenter(function () {
      $('ul>p').animate({
        left: 100 * $(this).index()
      }, 30).text($(this).text()).next().animate({
        left: 100 * $(this).index()
      }, 30);
    });
  </script>
</body>

</html>